#include <Game/Include/ClientLogic.h>


ClientLogic::ClientLogic(Channel* comm_channel, SyncQueue* output_queue)
    :DistributionLogic(comm_channel, output_queue)
{
    ChannelReceiverTaskData* receiver_data = new ChannelReceiverTaskData();
    receiver_data->channel = this->comm_channel;
    receiver_data->output_queue = this->output_queue;
    this->channel_receiver_task = new Task(channel_receiver_task_function, receiver_data, T_TaskPriority::TASK_PRIORITY_NORMAL, TASK_SLEEP_TIME_NULL);
    receiver_data->channel_receiver_task = channel_receiver_task;
    this->channel_receiver_task->start();
}

ClientLogic::~ClientLogic(void)
{
}

void ClientLogic::processGameEvent(GameEvent* game_event)
{
    SimpleMessage* simple_message = new SimpleMessage(game_event);
    this->comm_channel->send(simple_message);
}
